package com.xxl.job.admin.core.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author pan.shun
 * @since 2024/12/7 13:29
 */
public class TimeUtils {
    private static final SimpleDateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static Date timeConvert(String time) {
        try {
            return FORMAT.parse(time);
        } catch (Exception e) {
            return new Date();
        }
    }

    public static synchronized String timeConvert(Date date) {
        return FORMAT.format(date);
    }
}
